
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module main</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong>main</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/v/filer4b/v38q001/chanus/CS 373/Project 3/main.py">/v/filer4b/v38q001/chanus/CS 373/Project 3/main.py</a></font></td></tr></table>
    <p><tt>#&nbsp;-------------------------------<br>
#&nbsp;projects/python/voting/main.py<br>
#&nbsp;Copyright&nbsp;(C)&nbsp;2009<br>
#&nbsp;Glenn&nbsp;P.&nbsp;Downing<br>
#&nbsp;-------------------------------</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="main.html#Ballot">Ballot</a>
</font></dt><dt><font face="helvetica, arial"><a href="main.html#Candidate">Candidate</a>
</font></dt><dt><font face="helvetica, arial"><a href="main.html#InputReader">InputReader</a>
</font></dt><dt><font face="helvetica, arial"><a href="main.html#OutputWriter">OutputWriter</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Ballot">class <strong>Ballot</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>class&nbsp;that&nbsp;holds&nbsp;the&nbsp;information&nbsp;of&nbsp;a&nbsp;particular&nbsp;ballot&nbsp;and&nbsp;also<br>
who&nbsp;is&nbsp;the&nbsp;current&nbsp;winner&nbsp;of&nbsp;the&nbsp;ballot&nbsp;before&nbsp;reassigned&nbsp;if&nbsp;needed<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Ballot-current_Win"><strong>current_Win</strong></a>(self)</dt><dd><tt>#@return&nbsp;current&nbsp;winner&nbsp;position</tt></dd></dl>

<dl><dt><a name="Ballot-get_Winner"><strong>get_Winner</strong></a>(self)</dt><dd><tt>#&nbsp;@return&nbsp;the&nbsp;current&nbsp;winner&nbsp;in&nbsp;the&nbsp;list&nbsp;of&nbsp;candidates&nbsp;in&nbsp;this&nbsp;ballot</tt></dd></dl>

<dl><dt><a name="Ballot-initiate"><strong>initiate</strong></a>(self, x)</dt></dl>

<dl><dt><a name="Ballot-next_Winner"><strong>next_Winner</strong></a>(self)</dt><dd><tt>#set&nbsp;current&nbsp;winner&nbsp;to&nbsp;next&nbsp;candidate</tt></dd></dl>

<dl><dt><a name="Ballot-print_Votes"><strong>print_Votes</strong></a>(self)</dt><dd><tt>#prints&nbsp;votes&nbsp;in&nbsp;the&nbsp;ballot</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Candidate">class <strong>Candidate</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>the&nbsp;class&nbsp;<a href="#Candidate">Candidate</a>&nbsp;for&nbsp;holding&nbsp;the&nbsp;informatino&nbsp;of&nbsp;each&nbsp;of&nbsp;the<br>
participants&nbsp;of&nbsp;the&nbsp;australian&nbsp;vote<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Candidate-add_Ballot"><strong>add_Ballot</strong></a>(self, ballot)</dt><dd><tt>#@param&nbsp;assigns&nbsp;a&nbsp;ballot&nbsp;to&nbsp;the&nbsp;candidate</tt></dd></dl>

<dl><dt><a name="Candidate-get_Ballots"><strong>get_Ballots</strong></a>(self)</dt><dd><tt>#@return&nbsp;the&nbsp;vector&nbsp;of&nbsp;ballots&nbsp;this&nbsp;candidate&nbsp;owns</tt></dd></dl>

<dl><dt><a name="Candidate-get_Name"><strong>get_Name</strong></a>(self)</dt><dd><tt>#@return&nbsp;candidates&nbsp;name</tt></dd></dl>

<dl><dt><a name="Candidate-get_Number"><strong>get_Number</strong></a>(self)</dt><dd><tt>#@return&nbsp;the&nbsp;position&nbsp;in&nbsp;the&nbsp;list&nbsp;of&nbsp;candidates&nbsp;this&nbsp;lies</tt></dd></dl>

<dl><dt><a name="Candidate-get_Votes"><strong>get_Votes</strong></a>(self)</dt><dd><tt>#@return&nbsp;total&nbsp;amount&nbsp;of&nbsp;votes&nbsp;for&nbsp;this&nbsp;candidate</tt></dd></dl>

<dl><dt><a name="Candidate-initiate"><strong>initiate</strong></a>(self, Cname, num)</dt></dl>

<dl><dt><a name="Candidate-lost"><strong>lost</strong></a>(self)</dt><dd><tt>#labels&nbsp;this&nbsp;candidate&nbsp;a&nbsp;loser</tt></dd></dl>

<dl><dt><a name="Candidate-next_Winner"><strong>next_Winner</strong></a>(self)</dt><dd><tt>#shifts&nbsp;all&nbsp;this&nbsp;candidates&nbsp;current&nbsp;ballots&nbsp;to&nbsp;have&nbsp;a&nbsp;different&nbsp;winner</tt></dd></dl>

<dl><dt><a name="Candidate-not_Lost"><strong>not_Lost</strong></a>(self)</dt><dd><tt>#@return&nbsp;whether&nbsp;the&nbsp;candidate&nbsp;isn't&nbsp;a&nbsp;loser</tt></dd></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="InputReader">class <strong>InputReader</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="InputReader-read"><strong>read</strong></a>(self)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="OutputWriter">class <strong>OutputWriter</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="OutputWriter-write"><strong>write</strong></a>(self, *a)</dt></dl>

<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-main"><strong>main</strong></a>()</dt><dd><tt>runs&nbsp;the&nbsp;program</tt></dd></dl>
 <dl><dt><a name="-my_eval"><strong>my_eval</strong></a>()</dt><dd><tt>Find&nbsp;out&nbsp;who&nbsp;the&nbsp;winner&nbsp;of&nbsp;the&nbsp;australian&nbsp;voting&nbsp;is,&nbsp;if&nbsp;a&nbsp;tie&nbsp;redistribute&nbsp;the&nbsp;votes<br>
to&nbsp;the&nbsp;other&nbsp;deserving&nbsp;&nbsp;candidates&nbsp;until&nbsp;there&nbsp;is&nbsp;no&nbsp;longer&nbsp;a&nbsp;tie&nbsp;or&nbsp;that&nbsp;it&nbsp;is<br>
an&nbsp;official&nbsp;tie</tt></dd></dl>
 <dl><dt><a name="-my_print"><strong>my_print</strong></a>(w)</dt><dd><tt>writes&nbsp;the&nbsp;winner&nbsp;and&nbsp;a&nbsp;newline&nbsp;if&nbsp;needed</tt></dd></dl>
 <dl><dt><a name="-my_read"><strong>my_read</strong></a>(r)</dt><dd><tt>reads&nbsp;an&nbsp;int&nbsp;into&nbsp;num_candidates&nbsp;and&nbsp;update&nbsp;the&nbsp;candidates<br>
if&nbsp;we&nbsp;get&nbsp;a&nbsp;EOF&nbsp;we&nbsp;know&nbsp;we&nbsp;are&nbsp;at&nbsp;the&nbsp;last&nbsp;case,&nbsp;the&nbsp;Ballots<br>
are&nbsp;also&nbsp;constructed&nbsp;and&nbsp;assigned&nbsp;to&nbsp;candidates<br>
return&nbsp;true&nbsp;if&nbsp;that&nbsp;succeeds,&nbsp;false&nbsp;otherwise</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>candidates</strong> = []<br>
<strong>cases</strong> = 0<br>
<strong>num_candidates</strong> = 0<br>
<strong>winner</strong> = ''</td></tr></table>
</body></html>